<?php
$tm = $_GET['tm'];
$da = json_decode($tm,true);
$data=array('csm'=>"我的渣男/渣女小瓶子",'dfjs'=>"渣的程度：",'df'=>null,'bq1' =>"花心😍",'bq2'=>"爱美😘",'bq3'=>"卑微😞",'bq4'=>"出轨🙃",'bq5'=>"撒谎🤥",'bq6' =>"套路🤪",'bq7'=>"责任😎",'bq8'=>"情话王😛",'bq9'=>null,'pf1' =>3,'pf2'=>4,'pf3'=>3,'pf4'=>3,'pf5'=>3,'pf6' =>2,'pf7'=>3,'pf8'=>null);
$df = 0;
for($i=0; $i<4; $i++){
   switch ($i){
       case 0: switch($da[0])
                    {case A: $df=1; $data[pf1]=1; $data[pf3]=5;break;
                     case B: $df=25; $data[pf1]=4; $data[pf3]=1;break;
                     case C: $df=15; $data[pf1]=3; $data[pf3]=3;break;
                     }break;
       case 1:switch($da[1])
                    {case A: $df=$df+0; $data[pf2]=1; $data[pf4]=1;break;
                     case B: $df=$df+25; $data[pf2]=4; $data[pf4]=4;break;
                     case C: $df=$df+15; $data[pf2]=2; $data[pf4]=2;break;
                     }break;
       case 2:switch($da[2])
                    {case A: $df=$df+0;  $data[pf7]=5; $data[pf5]=1;break;
                     case B: $df=$df+25;  $data[pf7]=2; $data[pf5]=4;break;
                     case C: $df=$df+15;  $data[pf7]=3; $data[pf5]=2;break;
                     }break;
       case 3:switch($da[3])
                    {case A: $df=$df+0; $data[pf8]=1; $data[pf6]=1; break;
                     case B: $df=$df+25; $data[pf8]=5; $data[pf6]=4;break;
                     case C: $df=$df+15; $data[pf8]=3; $data[pf6]=2; break;
                     }break;
   }
}
if($df>=50){
	$data[pf3]=1;
	$data[pf7]=1;
}
$data[df]=$df.'%';
echo json_encode($data,JSON_UNESCAPED_UNICODE);
$conn = new mysqli('127.0.0.1', '3h74cu729i222', 'gm666946','3h74cu729i222');
$conn ->set_charset("utf8");
$sql = "SELECT * FROM sjtj WHERE num = 0";
$res=$conn->query($sql);
$data=$res->fetch_all();
$sccs=$data[0][5]+1;
$sql = "UPDATE sjtj SET xpzcscs = '$sccs' WHERE num = 0";
$res=$conn->query($sql);
$conn->close();
?>